<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JMS 登录</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 90vh;
            background-color: #f0f0f0;
            background: url(./sound/index.jpg);
        }
        /* .login-container {
            display: flex;
            width: 500px;
            flex-direction: column;
            align-items: center;
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        } */
        .login-container {
    display: flex;
    width: 500px;
    flex-direction: column;
    align-items: center;
    background-color: transparent; /* 设置为透明 */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
        .login-container h2 {
            margin-bottom: 20px;
            text-align: center;
        }
        .login-container input {
            width: 70%;
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .login-container button {
            width: 40%;
            padding: 10px;
            border: none;
            background-color: #007BFF;
            color: #fff;
            border-radius: 4px;
            cursor: pointer;
        }
        .login-container button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>极兔登录</h2>
        <input type="yunda_wd" id="yunda_wd" placeholder="网点" required>
        <!-- <input type="pad_sn" id="pad_sn" placeholder="巴枪号" required> -->
        <input type="text" id="username" placeholder="账号" required>
        <input type="password" id="password" placeholder="密码" required>
        <button onclick="login()">登录</button>
    </div>

    <script>
        async function login() {
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            const jtWd = document.getElementById('yunda_wd').value;
            // const pad_sn = document.getElementById('pad_sn').value;
            const res = await fetch(`http://localhost:3001/JtLog?account=${username}&password=${password}&jtWd=${jtWd}`, {
                method: 'GET',
                headers: {
                    'Content-Type': 'application/json'
                }
            });
            const data = await res.json();
            console.log(data);
            
            if (data.data===true) {
                window.location.href = 'http://localhost:3001/jtHome';
            } else {
                alert(data.data);
            }
        }
    </script>
</body>
</html>